Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Replace hard code page size. #2622

Merged
merged 16 commits into from
Oct 18, 2021

Conversation

vibros68
Copy link
Contributor

@vibros68 vibros68 commented Sep 30, 2021

Closes #2604.

decred/politeia#1518 adds the page sizes to the policy replies. This
diff replace hardcoded page sizes to be the policy reply values.

@vibros68
Copy link
Contributor Author

vibros68 commented Oct 2, 2021

ready for review @lukebp

@vibros68 vibros68 changed the title [WIP] replace hard code page size replace hard code page size Oct 2, 2021
@vibros68 vibros68 changed the title replace hard code page size refactor: Replace hard code page size Oct 2, 2021
@vibros68 vibros68 changed the title refactor: Replace hard code page size refactor: Replace hard code page size. Oct 2, 2021
Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still seeing a lot of hardcoded page sizes.

$ grep -rinI --exclude-dir={node_modules,build,bin} page_size *
src/containers/Proposal/helpers.js:33:  PROPOSAL_PAGE_SIZE,
src/containers/Proposal/helpers.js:458:  pageSize = PROPOSAL_PAGE_SIZE
src/containers/Proposal/User/hooks.js:24:import { PROPOSAL_PAGE_SIZE } from "src/constants";
src/containers/Proposal/User/hooks.js:84:  proposalPageSize = PROPOSAL_PAGE_SIZE,
src/containers/Proposal/User/Submitted.jsx:14:const PAGE_SIZE = 20;
src/containers/Proposal/User/Submitted.jsx:60:    amountOfMissingProposals > PAGE_SIZE ? PAGE_SIZE : amountOfMissingProposals;
src/containers/Proposal/Download/hooks.js:11:const TIMESTAMPS_PAGE_SIZE = 100;
src/containers/Proposal/Download/hooks.js:18:  const multiPage = votesCount > TIMESTAMPS_PAGE_SIZE;
src/containers/Proposal/Download/hooks.js:25:      total ? ((total * TIMESTAMPS_PAGE_SIZE) / votesCount).toFixed(0) : 0,
src/containers/Comments/Download/hooks.js:38:const TIMESTAMPS_PAGE_SIZE = 100;
src/containers/Comments/Download/hooks.js:53:  const multiPage = commentsLength > TIMESTAMPS_PAGE_SIZE;
src/containers/Comments/Download/hooks.js:62:    take(TIMESTAMPS_PAGE_SIZE)(commentIds),
src/containers/Comments/Download/hooks.js:63:    takeRight(commentIds.length - TIMESTAMPS_PAGE_SIZE)(commentIds)
src/constants.js:102:export const PROPOSAL_PAGE_SIZE = 5;
src/constants.js:103:export const INVENTORY_PAGE_SIZE = 20;
src/components/RecordsView/RecordsView.jsx:12:  PROPOSAL_PAGE_SIZE
src/components/RecordsView/RecordsView.jsx:68:  pageSize = PROPOSAL_PAGE_SIZE,
src/hooks/api/useProposalsBatch.js:26:  INVENTORY_PAGE_SIZE,
src/hooks/api/useProposalsBatch.js:27:  PROPOSAL_PAGE_SIZE,
src/hooks/api/useProposalsBatch.js:92:  proposalPageSize = PROPOSAL_PAGE_SIZE,
src/hooks/api/useProposalsBatch.js:93:  inventoryPageSize = INVENTORY_PAGE_SIZE
src/hooks/api/useApprovedProposals.js:5:const PAGE_SIZE = 20;
src/hooks/api/useApprovedProposals.js:25:          PAGE_SIZE
teste2e/cypress/e2e/proposal/list.js:12:const RECORDS_PAGE_SIZE = 5;
teste2e/cypress/e2e/proposal/list.js:186:      cy.assertListLengthByTestId("record-title", RECORDS_PAGE_SIZE) // first records batch
teste2e/cypress/e2e/proposal/list.js:260:      cy.assertListLengthByTestId("record-title", RECORDS_PAGE_SIZE).each(

@vibros68
Copy link
Contributor Author

vibros68 commented Oct 2, 2021

Some of those are my mistake. But some others are I leave to be a default value. Do you want to remove those completely?

@amass01
Copy link
Member

amass01 commented Oct 2, 2021

Hrmm some are not related to the backend page size and I used for other purposes.

Examples:
src/hooks/api/useApprovedProposals.js:5:const PAGE_SIZE = 20
src/components/RecordsView/RecordsView.jsx:12: PROPOSAL_PAGE_SIZE

Those I guess can stay for now, but all the API related ones should be removed.

Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@amass01 can you give this a review?

Also needs approval from @tiagoalvesdulce.

@@ -5,6 +5,9 @@ import ProposalLoader from "src/components/Proposal/ProposalLoader";
import useQueryStringWithIndexValue from "src/hooks/utils/useQueryStringWithIndexValue";
import { tabValues, statusByTab } from "./helpers";
import { mapProposalsTokensByTab } from "src/containers/Proposal/helpers";
import usePolicy from "src/hooks/api/usePolicy";
// XXX change to AdminActionsProvider
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it is generated automatically from code editor. I will remove it now. Thanks for your review @amass01

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, left one inline comment.

Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vibros68
Copy link
Contributor Author

Screenshot from 2021-10-13 20-34-08

Teste2e run successfully

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vibros68
you posted e2e tests only of one file.
also you exported all consts even though they are used only locally
i think we should export only the ones used outside the file.

@vibros68 vibros68 requested a review from amass01 October 15, 2021 10:18
Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see many tests are missing, run the following command to run all tests in teminal:
yarn test:e2e:run
Also make sure you don't have any .only on one of the tests.

Please don't post the test results in the PR commit message, makes it unreadable
a separate comment is ok, see my comment here #2629 (comment) as an example -
you can add collapsable sections to github's markdown which is quite useful is such cases.

@vibros68
Copy link
Contributor Author

Full detail teste2e for #ed27150

Click to expand!

Admin account actions
    ✓ Can search users (14284ms)
    ✓ Can navigate to the user page (10825ms)
    ✓ Can activate/deactivate a user (18587ms)
    ✓ Can mark user as paid (353ms)
    ✓ Can rescan user credits (10578ms)


  5 passing (55s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     55 seconds                                                                       │
  │ Spec Ran:     admin/account.js                                                                 │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  admin/comments.js                                                              (2 of 14)


  User admin comments
    ✓ Can censor comments (31487ms)


  1 passing (32s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        1                                                                                │
  │ Passing:      1                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     31 seconds                                                                       │
  │ Spec Ran:     admin/comments.js                                                                │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  admin/proposals.js                                                             (3 of 14)


  Admin proposals actions
    ✓ Should allow admins to approve propsoals (24456ms)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to report a proposal as a spam (23389ms)
    ✓ Should allow admins to abandon proposals (20140ms)
    ✓ Should allow proposal author to authorize voting (19863ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of an active propsoal (24456ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of a closed propsoal (23878ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of a completed propsoal (23569ms)
    ✓ Shouldn't allow admins set a billing status when number of billing status changes exceeds the `billingstatuschangesmax` policy (20317ms)


  8 passing (3m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        8                                                                                │
  │ Passing:      8                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     3 minutes, 1 second                                                              │
  │ Spec Ran:     admin/proposals.js                                                               │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  comments/authorUpdates.js                                                      (4 of 14)


  Proposal author updates
    ✓ Should allow proposal author to submit updates on active proposals & allow normal users to reply only on the latest author update (54434ms)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Shouldn't allow proposal author to submit updates on closed proposals (19084ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Shouldn't allow proposal author to submit updates on completed proposals (19470ms)


  3 passing (2m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        3                                                                                │
  │ Passing:      3                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     1 minute, 33 seconds                                                             │
  │ Spec Ran:     comments/authorUpdates.js                                                        │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  comments/comments.js                                                           (5 of 14)


  User comments
    ✓ Shouldn't allow submitting new comments if paywall not paid (24187ms)
[HPM] Error occurred while trying to proxy request /v1/user/payments/registration from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow user who paid the paywall to add new comments & vote or reply on others' comments (46597ms)

  Comments downloads
    ✓ should publicly allow users to download comments bundle (23545ms)
    ✓ should publicly allow users to download comments timestamps (23458ms)

  Comments error handling
    ✓ should display login modal when commenting with an expired user session (12726ms)


  5 passing (2m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     2 minutes, 11 seconds                                                            │
  │ Spec Ran:     comments/comments.js                                                             │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  comments/commentVotes.js                                                       (6 of 14)


  Comments Votes
    succeeded votes
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
      ✓ should submit comments votes successfully (34634ms)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
      ✓ should prevent multi-clicking (21383ms)
    failed votes
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
      ✓ should display error message (24859ms)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
      ✓ should reset votes count on error (27312ms)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
      ✓ should display login modal when voting with an expired user session (21978ms)


  5 passing (2m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     2 minutes, 11 seconds                                                            │
  │ Spec Ran:     comments/commentVotes.js                                                         │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  proposal/create.js                                                             (7 of 14)


  Proposal Create
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/count from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Non-paid user can not create proposals (22146ms)


  1 passing (22s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        1                                                                                │
  │ Passing:      1                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     22 seconds                                                                       │
  │ Spec Ran:     proposal/create.js                                                               │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  proposal/detail.js                                                             (8 of 14)


  Proposal details
    regular proposal renders correctly
      ✓ should render a propsoal with a short token (15020ms)
      ✓ should render a proposal with a full token (7430ms)
    proposal downloads
      ✓ should publicly allow to download proposal bundle (10482ms)
      ✓ should publicly allow to download proposal timestamps (10316ms)
    invalid proposal rendering
      ✓ should dislpay not found message for nonexistent proposals (2342ms)
    user proposals actions
      ✓ should be able to logout from unvetted proposal details page (20944ms)
      ✓ should render unvetted proposal details after admin/author login (33079ms)
    proposal status tags
      ✓ should display unvetted status tag properly (9486ms)
      ✓ should display unvetted censored status tag properly (8894ms)
      ✓ should display unvetted abandoned status tag properly (9677ms)
      ✓ should display censored status tag properly (9239ms)
      ✓ should display abandoned status tag properly (9874ms)
      ✓ should display under review status tag properly (9157ms)
      ✓ should display vote authorized status tag properly (9147ms)
      ✓ should display vote authorized status tag properly (9365ms)
      ✓ should display rejected status tag properly (9392ms)
      ✓ should display active status tag properly (9187ms)
      ✓ should display closed status tag properly (9367ms)
      ✓ should display completed status tag properly (11303ms)
    propsoal status metadata
      ✓ should display proposal status metadata on censored proposal (18090ms)
      ✓ should display proposal status metadata on abandoned proposal (21217ms)
      ✓ should display proposal status metadata on closed proposal (15421ms)


  22 passing (5m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        22                                                                               │
  │ Passing:      22                                                                               │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     4 minutes, 36 seconds                                                            │
  │ Spec Ran:     proposal/detail.js                                                               │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  proposal/edit.js                                                               (9 of 14)


  Proposal Edit
    ✓ Can edit a public proposal as a proposal owner (35439ms)
    ✓ Can't edit a proposal if not the owner (15018ms)
    ✓ Can't edit an authorized voting proposal (18441ms)
    ✓ Can't edit without making any changes (18450ms)


  4 passing (1m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        4                                                                                │
  │ Passing:      4                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     1 minute, 28 seconds                                                             │
  │ Spec Ran:     proposal/edit.js                                                                 │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  proposal/formErrorCodes.js                                                    (10 of 14)


  Proposal Form Error Codes Mapping
    ✓ Should map invalid name error code to a readable error message (12893ms)
    ✓ Should map invalid start date error code to a readable error message (5761ms)
    ✓ Should map invalid end date error code to a readable error message (5525ms)
    ✓ Should map invalid amount error code to a readable error message (5271ms)
    ✓ Should map invalid domain error code to a readable error message (5665ms)


  5 passing (35s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     35 seconds                                                                       │
  │ Spec Ran:     proposal/formErrorCodes.js                                                       │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  proposal/list.js                                                              (11 of 14)


  Records list
    records and inventory pagination
      ✓ should render list correctly when some status are empty (12406ms)
      ✓ should switch tabs and show empty message when list is empty (12585ms)
      ✓ should render all status even when page batch is not complete (6420ms)
      ✓ should scan inventory pages correctly (106093ms)
    proposals list
      ✓ should render first proposals batch according to inventory order (4465ms)
      ✓ should switch tabs and load proposals correctly (14308ms)
      ✓ should list legacy proposals (21472ms)
      ✓ should load sidebar according to screen resolution (2366ms)
      ✓ should render loading placeholders properly (2334ms)
    admin proposals list
      ✓ can render records list according to inventory order (6028ms)
      ✓ can render records and inventory pagination correctly (22264ms)
      ✓ can switch tabs and load proposals correctly (11084ms)
    Big screens and inventory length multiple of proposals page size
      ✓ can render under review records with 5 autorized tokens (9718ms)
      ✓ can render under review records with 5 started tokens (336ms)
      ✓ can render under review records with 5 tokens started and authorized (338ms)
      ✓ can render 10 authorized proposals (543ms)


  16 passing (5m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        16                                                                               │
  │ Passing:      16                                                                               │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     4 minutes, 38 seconds                                                            │
  │ Spec Ran:     proposal/list.js                                                                 │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  user/2fa.js                                                                   (12 of 14)


  Two-Factor Authentication
    ✓ should set and reset the 2fa code successfully (27651ms)
    ✓ should display error when setting up an invalid 2fa code (14082ms)


  2 passing (42s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        2                                                                                │
  │ Passing:      2                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     41 seconds                                                                       │
  │ Spec Ran:     user/2fa.js                                                                      │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  user/login.js                                                                 (13 of 14)


  Login
    ✓ Can login (14140ms)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Can login with an unpaid user (7760ms)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Can logout with a paid user (10024ms)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/count from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Can logout with an unpaid user (19857ms)
    ✓ Can logout with an unpaid user on payment screen (23255ms)

  2FA Login
    ✓ should display the 2FA modal when user totp is active (7634ms)
[HPM] Error occurred while trying to proxy request /ticketvote/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /pi/v1/summaries from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /records/v1/records from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ should display errors when 2FA code is invalid (6418ms)


  7 passing (2m)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        7                                                                                │
  │ Passing:      7                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     1 minute, 32 seconds                                                             │
  │ Spec Ran:     user/login.js                                                                    │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  user/register.js                                                              (14 of 14)


  Registration
    ✓ Can register users (17893ms)
    ✓ can pay the registration fee (15519ms)


  2 passing (34s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        2                                                                                │
  │ Passing:      2                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     33 seconds                                                                       │
  │ Spec Ran:     user/register.js                                                                 │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  admin/account.js                         00:55        5        5        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  admin/comments.js                        00:31        1        1        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  admin/proposals.js                       03:01        8        8        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  comments/authorUpdates.js                01:33        3        3        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  comments/comments.js                     02:11        5        5        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  comments/commentVotes.js                 02:11        5        5        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  proposal/create.js                       00:22        1        1        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  proposal/detail.js                       04:36       22       22        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  proposal/edit.js                         01:28        4        4        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  proposal/formErrorCodes.js               00:35        5        5        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  proposal/list.js                         04:38       16       16        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  user/2fa.js                              00:41        2        2        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  user/login.js                            01:32        7        7        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  user/register.js                         00:33        2        2        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        24:54       86       86        -        -        -  
\```

</p>
</details>  

@@ -108,7 +108,7 @@ describe("Proposal Edit", () => {
}) => {
cy.approveProposal(censorshiprecord);
cy.visit(`record/${shortRecordToken(censorshiprecord.token)}`);
cy.wait(1000);
cy.wait(3000);
Copy link
Member

@amass01 amass01 Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you need to wait 3 seconds here ?
if you are waiting to some API request, then wait for it
explicitly as we do in all other tests waiting for API requests.

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Your logs are full of warnings/errors where are they coming from ?
...

  Admin proposals actions
    ✓ Should allow admins to approve propsoals (24456ms)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to report a proposal as a spam (23389ms)
    ✓ Should allow admins to abandon proposals (20140ms)
    ✓ Should allow proposal author to authorize voting (19863ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of an active propsoal (24456ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of a closed propsoal (23878ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of a completed propsoal (23569ms)
    ✓ Shouldn't allow admins set a billing status when number of billing status changes exceeds the `billingstatuschangesmax` policy (20317ms)


...
  1. See refactor: Replace hard code page size. #2622 (comment)

@vibros68
Copy link
Contributor Author

vibros68 commented Oct 18, 2021

  1. Your logs are full of warnings/errors where are they coming from ?
...

  Admin proposals actions
    ✓ Should allow admins to approve propsoals (24456ms)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to report a proposal as a spam (23389ms)
    ✓ Should allow admins to abandon proposals (20140ms)
    ✓ Should allow proposal author to authorize voting (19863ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of an active propsoal (24456ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of a closed propsoal (23878ms)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/votes from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
[HPM] Error occurred while trying to proxy request /comments/v1/comments from localhost:3000 to https://localhost:4443 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)
    ✓ Should allow admins to set the billing status of a completed propsoal (23569ms)
    ✓ Shouldn't allow admins set a billing status when number of billing status changes exceeds the `billingstatuschangesmax` policy (20317ms)


...
  1. See refactor: Replace hard code page size. #2622 (comment)

Some requests to the server is failed. It becauses my computer is weak. When it is running heavy it losts some requests

@vibros68
Copy link
Contributor Author

About changed from 1 second to 3 seconds. It is not waitting for an api request. It is after creating a proposal and click edit button. But because my laptop is weak and while running entire the teste2e. It becomes very slow. If I let 1 sec on there. The test will not stable. Some time it is passed and some time it is not. @amass01

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK list view on firefox.

@lukebp lukebp merged commit 146dfc1 into decred:master Oct 18, 2021
@vibros68 vibros68 mentioned this pull request Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace hard coded page sizes.
4 participants